#include "FioriMenuNode.h"
#include <sstream>
using namespace std;


FioriMenuNode::FioriMenuNode(const wstring& id, const wstring& name, const wstring& icon)
	: m_menuId(id), m_displayName(name), m_catalogIcon(icon)
{
}


FioriMenuNode::~FioriMenuNode(void)
{
}

vector<FioriMenuNode>& FioriMenuNode::getNodes()
{
	return m_nodes;
}

wstring FioriMenuNode::toString() const
{
	wstringstream ss;
	int i;

	ss << L"{id:'" 
		<< m_menuId 
		<< L"',name:'" 
		<< m_displayName 
		<< L"',icon:'" 
		<< m_catalogIcon 
		<< L"',nodes:[";

	i = 0;
	for (auto it = m_nodes.cbegin(); it != m_nodes.cend(); it++, i++)
	{
		ss << it->toString();
		if(i > 0) ss << L",";
	}

	ss << L"]}";

	return ss.str();
}

const wstring& FioriMenuNode::getMenuId() const
{
	return m_menuId;
}

const wstring& FioriMenuNode::getDisplayName() const
{
	return m_displayName;
}

const wstring& FioriMenuNode::getCatalogIcon() const
{
	return m_catalogIcon;
}